package tests;

import common.Utils;
import org.openqa.selenium.By;

public class DetialPage extends Utils {
    public static String url = "http://8.137.19.140:9090/blog_detail.html?blogId=141789";
    public DetialPage() {
        super(url);
    }

    /*
    * 通过检查博客详情页各个元素来验证
    * */
    public void DetailPageByLogin() throws InterruptedException {
        //查找是否有“用户个人信息模块”
        driver.findElement(By.cssSelector("body > div.container > div.left > div"));
        //查找是否有“编辑”按钮
        driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(1)"));
        //查找是否有“删除”按钮
        driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(2)"));
        Thread.sleep(2000);

        //验证“删除博客”
        //点击删除按钮
        driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(2)")).click();
        //处理弹窗
        driver.switchTo().alert().accept();
        Thread.sleep(2000);

        driver.quit();
    }

}
